﻿@using Windvoice.Blog
@using Windvoice.Library.Mvc
@{
    ViewBag.Title = "Article";
    Layout = "~/Areas/Manage/Views/Shared/_Layout.cshtml";
}

@section headSection{
    <script type="text/javascript">
        $(function () {
            $('a[data-delete]').click(function () { $(this).handledelete('/manage/article/delete') });
            $('#create-index').click(function () {
                var $this = $(this);
                $this.css({ 'color': 'gray' }).html('正在重建...');
                $.post('/manage/article/createindex', { _id: new Date().getMilliseconds() }, function (data) {
                    alert(data.result + ':' + data.message);
                    $this.removeAttr('style').html('重建索引');
                }, 'json');
            });
        });
    </script>
}

<div class="pagetitle">
    <h2>日志管理</h2>
    <div class="pagefunctions">
        @Html.ActionLink("创建日志", "create")
        <a href="javascript:;" id="create-index">重建索引</a>
    </div>    
</div>

<ul class="blog-list">
    @foreach (Article article in (Article[])ViewBag.ArticleList)
    {
        <li>
            <div class="title">
                <div class="titlevalue"><a href="/blog/@article.UniqueKey" target="_blank">@article.Title</a></div>
                <div class="operate">
                    <a href="/manage/article/edit/@article.ID">编辑</a>
                    <a href="javascript:;" data-delete="@article.ID">删除</a>
                </div>
            </div>
            <div class="content">
                分类：@(Category.Find(article.CategoryID).Name)
                创建时间：@(article.CreateTime.ToString("yyyy-MM-dd HH:mm:ss"))
                点击：@article.Hits
            </div>
        </li> 
    }
</ul>

@Html.Pager((int)ViewBag.RecordCount,PageSize:(int)ViewBag.PageSize)